package com.hd.hdxgddtools.mybatis.config;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.generator.config.rules.DateType;
import lombok.Data;

@Data
public class GlobalConfig {
    private String outputDir;
    private boolean fileOverride;
    private boolean open;
    private boolean enableCache;
    private String author;
    private boolean kotlin;
    private boolean swagger2;
    private boolean activeRecord;
    private boolean baseResultMap;
    private String dateType = "ONLY_DATE";
    private boolean baseColumnList;
    private String entityName;
    private String mapperName;
    private String xmlName;
    private String serviceName;
    private String serviceImplName;
    private String controllerName;
    private String idType = "INPUT";


    public com.baomidou.mybatisplus.generator.config.GlobalConfig toGlobalConfig(String project) {
        com.baomidou.mybatisplus.generator.config.GlobalConfig config = new com.baomidou.mybatisplus.generator.config.GlobalConfig();
        config
                .setOutputDir(project + "/" + this.outputDir)
                .setFileOverride(this.fileOverride)
                .setOpen(this.open)
                .setEnableCache(this.enableCache)
                .setAuthor(this.author)
                .setKotlin(this.kotlin)
                .setSwagger2(this.swagger2)
                .setActiveRecord(this.activeRecord)
                .setDateType(DateType.valueOf(this.dateType))
                .setBaseResultMap(this.baseResultMap)
                .setBaseColumnList(this.baseColumnList)
                .setEntityName(this.entityName)
                .setMapperName(this.mapperName)
                .setXmlName(this.xmlName)
                .setServiceName(this.serviceName)
                .setServiceImplName(this.serviceImplName)
                .setControllerName(this.controllerName)
                .setIdType(IdType.valueOf(this.idType));
        return config;
    }
}